package com.wanbangee.marksystem.dao;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import com.wanbangee.marksystem.entities.SScoreDetail;

@Mapper 
public interface SScoreDetailDao {
	public List<SScoreDetail> selectScoreByMarkerId(Integer markerId,Integer examId,Integer examSubId,Integer scoreType);

	public Map<Object, Object> selectAllAvgMaxMin(Integer examId,Integer examSubId,Integer topicNo,Integer scoreType);

	/**
	 * 根据排序规则来获取成绩列表
	 * @param markerId
	 * @param order
	 * @return
	 */
	public List<SScoreDetail> selectScoreByOrderAndMarkerId(Integer examId,Integer examSubId,Integer topicNo,Integer markerId,Integer order,Integer scoreType);


	/**
	 * 将分数都恢复到最初值
	 * @param examId
	 * @param examSubId
	 * @param scoreId
	 * @return
	 */
	public Integer updateSScoreDetailByScoreId(Integer examId,Integer examSubId,Integer scoreId);
	
	//=============================================================================
	
	//插入
	
	/**
	 * 插入一条分数记录,并返回自增主键到实体类上
	 * @param examId
	 * @param examSubId
	 * @param scoreId
	 * @param score
	 * @return 
	 */
	public Integer insertScoreDetail(@Param("examId")Integer examId,@Param("examSubId")Integer examSubId,@Param("scoreId")Integer scoreId,@Param("score")Double score);

	
		
	/**
	 * 修改阅卷分数（提交阅卷打分）
	 * @param examId
	 * @param examSubId
	 * @param scoreId 阅卷id
	 * @param score 分数
	 * @param scoreName	需要修改的字段名，score1，score2
	 */
	public Integer updateScoreByExamIdExamSubIdScoreIdScoreScoreName(@Param("examId")Integer examId,@Param("examSubId")Integer examSubId,@Param("scoreId")Integer scoreId,@Param("score")Double score,@Param("scoreName")String scoreName);

	/**
	 * 修改仲裁分数（提交仲裁打分）
	 * @param examId
	 * @param examSubId
	 * @param scoreId 阅卷id
	 * @param score 分数
	 */
	public void updateArbitrationScoreByExamIdExamSubIdScoreIdScoreScoreName(Integer examId, Integer examSubId,
			Integer scoreId, Double score);
	
	/**
	 * 修改阅卷分数（重评提交阅卷打分）
	 * @param examId
	 * @param examSubId
	 * @param scoreId 阅卷id
	 * @param score 分数
	 * @param scoreName	需要修改的字段名，score1，score2
	 */
	public Integer updateScoreByExamIdExamSubIdScoreIdScoreScoreNameOnRepeat(@Param("examId")Integer examId,@Param("examSubId")Integer examSubId,@Param("scoreId")Integer scoreId,@Param("score")Double score,@Param("scoreName")String scoreName);

}
